local Json = require("common.Json")
local DeliverDefine = require("tencentApi.Define")

function reportQuit(human,code)
	s2aParam = {}
    local now = os.time()

    local pf_info = human.pf_info
    if (pf_info == nil) then
        return
    end

	api_param = {}
    api_param.userip = human.ip
    api_param.time = now
    api_param.pf = pf_info.pf
    api_param.worldid = pf_info.serverid
    --api_param.opuid = human.db._id
    api_param.opopenid = pf_info.openid
    api_param.onlinetime = now - human.db.lastLoginTime
    api_param.account = human.account
    api_param.openkey = pf_info.openkey
    api_param.pfkey = pf_info.pfkey
    s2aParam.api_param = api_param

	_G.thread_http.send(DeliverDefine.COMPASS_QUIT_PHP,Json.Encode(s2aParam))
end

function reportLogin(human)

	s2aParam = {}
    local now = os.time()

    local pf_info = human.pf_info
    if (pf_info == nil) then
        return
    end

	api_param = {}
    api_param.userip = human.ip
    api_param.time = now
    api_param.pf = pf_info.pf
    api_param.worldid = pf_info.serverid
    --api_param.opuid = human.db._id
    api_param.opopenid = pf_info.openid
    api_param.account = human.account
    api_param.openkey = pf_info.openkey
    api_param.pfkey = pf_info.pfkey
    api_param.level = human.db.lv
    api_param.x5sig = pf_info.x5sig
    
    s2aParam.api_param = api_param 

	_G.thread_http.send(DeliverDefine.COMPASS_LOGIN_PHP,Json.Encode(s2aParam))
end


